#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>

using namespace std;

long double fact(long double fNum)
{
   long double fVal = 1;
   for (long double fCntr=fNum; fCntr>0; fCntr--)
   {
      fVal = fVal * fCntr;
   }
   return fVal;
}

long double sum(long double fNum)
{
   long double fVal = 0;
   for (long double fCntr=0; fCntr<=fNum; fCntr++)
   {
      fVal += fCntr;
   }
   return fVal;
}

template<typename T>
void Print(T sVal, ofstream &ofs)
{
   cout << scientific << setprecision(2) << setw(12) << left << sVal;
   ofs << scientific << setprecision(2) << setw(12) << left << sVal;
}

int main(int argc, char *argv[])
{
   ofstream ofs;
   ofs.open("OutputFile.text");
   cout << endl;
   Print("n", ofs);
   Print("log(n)", ofs);
   Print("n*log(n)", ofs);
   Print("sum(1..n)", ofs);
   Print("n^2", ofs);
   Print("n^3", ofs);
   Print("n^4", ofs);
   Print("n^5", ofs);
   Print("2^n", ofs);
   Print("3^n", ofs);
   Print("4^n", ofs);
   Print("5^n", ofs);
   Print("fact(n)", ofs);
   Print("n^n", ofs);
   cout << endl << endl;
   for (int i=0; i<14; i++)
   {
      Print("0", ofs);
   }
   cout << endl;
   for (long double fN=1; fN<31; fN++)
   {
      Print(fN, ofs);
      Print(logl(fN), ofs);
      Print(fN * logl(fN), ofs);
      Print(sum(fN), ofs);
      Print(pow(fN, 2), ofs);
      Print(pow(fN, 3), ofs);
      Print(pow(fN, 4), ofs);
      Print(pow(fN, 5), ofs);
      Print(pow(2, fN), ofs);
      Print(pow(3, fN), ofs);
      Print(pow(4, fN), ofs);
      Print(pow(5, fN), ofs);
      Print(fact(fN), ofs);
      Print(pow(fN, fN), ofs);
      cout << endl;
   }
   cout << endl;
   ofs.close();
   return 0;
}
